Skip to content

Fix metagame 0.5.0 ImportError from missing future annotations#384

Closed
crthpl wants to merge 1 commit intomainfrom
fix/metagame-future-annotations
Closed

Fix metagame 0.5.0 ImportError from missing future annotations#384
crthpl wants to merge 1 commit intomainfrom
fix/metagame-future-annotations

Conversation

@crthpl
Copy link
Copy Markdown
Contributor

@crthpl crthpl commented Apr 13, 2026

Summary

  • 0.5.0 dropped from __future__ import annotations in trading_client.py, so class-body type hints are now evaluated at import time. get_market_positions is annotated with websocket_api.MarketPositions, which doesn't exist as a symbol in websocket_api, so import metagame raises AttributeError and any consumer crash-loops on startup (already observed bringing down the scenarios server Fly deploy).
  • Restores the future import and bumps to 0.5.1. Runtime behavior is unchanged.

Test plan

  • uv sync && uv run python -c "from metagame import TradingClient" succeeds locally
  • uv build produces metagame-0.5.1-py3-none-any.whl and metagame-0.5.1.tar.gz
  • After release, bump metagame==0.5.1 in dependent projects (scenarios) and confirm Fly smoke checks pass

The 0.5.0 release dropped `from __future__ import annotations` in
trading_client.py, so class-body type hints are now evaluated at import
time. One of them (`get_market_positions` → `websocket_api.MarketPositions`)
references a class that doesn't exist, which means `import metagame` raises
AttributeError and any consumer crashes on startup. Restoring the future
import fixes this without touching runtime behavior. Bumps to 0.5.1.
@crthpl crthpl requested a review from a team as a code owner April 13, 2026 21:51
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
platform Ready Ready Preview, Comment Apr 13, 2026 9:52pm

Request Review

@crthpl
Copy link
Copy Markdown
Contributor Author

crthpl commented Apr 13, 2026

Superseded by #385 — deleting the dead get_market_positions method is a cleaner fix than hiding it behind lazy annotations. (0.5.1 was already published from this branch before we realized the method was dead; 0.5.2 contains the cleanup.)

@crthpl crthpl closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant